package com.example.smarthome;

public abstract class SmartDevice implements Controllable {
    protected String deviceId;
    protected String deviceName;
    protected boolean isOn;

    public SmartDevice(String deviceId, String deviceName) {
        this.deviceId = deviceId;
        this.deviceName = deviceName;
        this.isOn = false;
    }

    @Override
    public void turnOn() {
        isOn = true;
        System.out.println(deviceName + " 已开启。");
    }

    @Override
    public void turnOff() {
        isOn = false;
        System.out.println(deviceName + " 已关闭。");
    }

    @Override
    public String getStatus() {
        return String.format("[%s] 状态：%s", deviceName, isOn ? "开启" : "关闭");
    }

    public abstract String getDeviceType();
}